package main

import (
	"os"
	"os/signal"
	l "util/log"
	"world/config"
	"world/core"
)

func main() {

	c := config.CreateConfig()
	if !c.Load() {
		l.LogError("load config failed")
		return
	}

	ch := make(chan bool)

	w := core.GetWorld()
	go w.Start(c, ch)

	s := make(chan os.Signal, 1)
	signal.Notify(s, os.Interrupt)
	go func() {
		select {
		case <-s:
			core.ServiceQuit()
			l.TraceInfo("world", "stop service")
		}
	}()

	<-ch

}
